1. Field of the Invention
The present invention relates to a method, system, and article of manufacture for specifying user defined or translator definitions to use to interpret mnemonics in a computer program.
2. Description of the Related Art
Programmers write computer programs in computer languages referred to as the source code which includes data declarations and instructions that operate on data. The programmer writes keywords and commands in a language to instruct the language translator to perform certain actions. Such keywords and commands typically have meanings relevant to the context of their use, and may be abbreviated in a mnemonic form. A “mnemonic” as that term is used and defined herein may comprise a string of one or more characters, keyword, etc. having a defined meaning in a computer language. Before the program can be executed, the source code must be transformed to machine readable executable code.
Every programming language has a number of reserved names, language keywords, or mnemonics necessary for the language translator (a compiler, assembler, interpreter, etc.) to understand the structure and content of programs written in that language. The presence of reserved mnemonics may preclude the programmer from using such mnemonics in unexpected or ambiguous ways. If a programmer uses a mnemonic that matches a reserved mnemonic, also known as a built-in translator defined mnemonic, then the match may result in a misinterpretation of the meaning or structure of the program or an error message that may not indicate the actual cause of the problem.
Language keyword redefinition is especially problematic for assembler languages, where mnemonics can be used for referencing objects not defined in the program currently being assembled, and for instruction mnemonics. Most assemblers support a capability to allow the programmer to use mnemonics with the standard statement syntax to refer to both built-in or pre-defined mnemonics (such as assembler directives and machine instructions) and to user-defined mnemonics (such as macro-instructions). If the same statement syntax is used, the programmer may consequently write a statement in which such a mnemonic refers either to a built-in instruction known to the assembler or to a previously coded user-defined macro-instruction.
Prior art assembler implementations avoid possible conflicts between built-in and user defined mnemonic definitions by allowing only one definition of a given mnemonic to be used, to the exclusion of the other. That is, only one allowed form of any language keyword in the form of a mnemonic is supported, either as a built-in instruction or a macro-instruction, but not both.
As machine architectures and assembler facilities evolve, it is possible that the introduction of new built-in machine instruction mnemonics or assembler instruction mnemonics will conflict with existing user-defined macro-instruction mnemonics or the creation of new user-defined or vendor-supplied macro-instruction mnemonics will conflict with existing built-in mnemonics. In such cases, the programmer must either change the coding of his user-defined mnemonics to avoid using the unwanted new definition of the built-in machine instruction mnemonic, or must change the name of his user-defined macro-instruction to avoid conflicts when using the new built-in mnemonic.
For example, in the IBM® zSeries® z/Architecture® computers from International Business Machines Corporation, a new machine instruction with mnemonic MSG was introduced. The mnemonic MSG had been widely used in many programs for user-defined message-generating macro-instructions as a convenient abbreviation for “MESSAGE”. The built-in machine instruction stands for MULTIPLY SINGLE (the G of MSG indicates the 64-bit version). Programs using such user-defined MSG macro-instructions that had the same name as the MULTIPLY SINGLE built-in instruction were faced with the problem of either avoiding the use of the new MSG machine instruction or of rewriting the MSG macro-instruction with a new name and then revising all programs that previously used the MSG mnemonic for the MSG macro-instruction to use the new name instead. For large volumes of code, such changes can impose an expensive updating burden, and require extensive retesting of many programs. (IBM, zSeries, and z/Architecture are registered trademarks of International Business Machines Corporation in the United States, other countries, or both).
To avoid this problem, programmers may devise complex programming techniques that tell the assembler to use one or the other definition of a mnemonic alternately. However, such advanced programming techniques may be error-prone and likely to confuse later readers or maintainers of the program who do not understand such techniques which may not be documented or widely known.
Thus, there is a need for techniques to provide flexibility to users of programming languages in specifying a user defined or translator defined definition for a mnemonic.